﻿'
' Boogaloo® - http://www.mindfly.com
' Copyright (c) 2008
' by Mindfly, Inc.
'
' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
' documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
' to permit persons to whom the Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all copies or substantial portions 
' of the Software.
'
' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
' INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
' DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
' SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
' SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
' WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
' THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Imports System.Xml
Imports Boogaloo.Core.UI
Imports Boogaloo.Core.BLL

Namespace UI.Controls

    Public MustInherit Class LabelHiddenControlBase
        Inherits CompositeControl

#Region "Properties"


        Protected _label As Label
        Public Property label() As String
            Get
                EnsureChildControls()
                Return _label.Text
            End Get
            Set(ByVal value As String)
                EnsureChildControls()
                _label.Text = value
                If String.IsNullOrEmpty(_label.Text) Then
                    _label.Visible = False
                Else
                    _label.Visible = True
                End If
            End Set
        End Property

        Protected _requiredfieldvalidator As RequiredFieldValidator

        Protected _linkbutton As LinkButton
        Public Property linkbutton() As String
            Get
                EnsureChildControls()
                Return _linkbutton.Text
            End Get
            Set(ByVal value As String)
                EnsureChildControls()
                _linkbutton.Text = value
            End Set
        End Property


        Protected _hyperlink As HyperLink
        Public Property cancel_text() As String
            Get
                EnsureChildControls()
                Return _hyperlink.Text
            End Get
            Set(ByVal value As String)
                EnsureChildControls()
                _hyperlink.Text = value
            End Set
        End Property


        Public Property CommandArgument() As String
            Get
                EnsureChildControls()
                Return _linkbutton.CommandArgument
            End Get
            Set(ByVal value As String)
                EnsureChildControls()
                _linkbutton.CommandArgument = value
            End Set
        End Property

        Public Property label_cssclass() As String
            Get
                EnsureChildControls()
                Return _label.CssClass
            End Get
            Set(ByVal value As String)
                EnsureChildControls()
                _label.CssClass = value
            End Set
        End Property

        Public Property label_tooltip() As String
            Get
                EnsureChildControls()
                Return _label.ToolTip
            End Get
            Set(ByVal value As String)
                EnsureChildControls()
                _label.ToolTip = value
            End Set
        End Property

        Public Property ErrorMessage() As String
            Get
                EnsureChildControls()
                Return _requiredfieldvalidator.ErrorMessage
            End Get
            Set(ByVal value As String)
                EnsureChildControls()
                _requiredfieldvalidator.ErrorMessage = value
            End Set
        End Property

        Protected _validate As Boolean = False
        Public Property validate() As Boolean
            Get
                EnsureChildControls()
                Return _validate
            End Get
            Set(ByVal value As Boolean)
                EnsureChildControls()
                _validate = value
                If validate Then
                    EnsureChildControls()
                    _requiredfieldvalidator.Enabled = True
                    _requiredfieldvalidator.Visible = True
                Else
                    _requiredfieldvalidator.Enabled = False
                    _requiredfieldvalidator.Visible = False
                End If
            End Set
        End Property


        Protected _validation_group As String = String.Empty
        Public Property ValidationGroup() As String
            Get
                Return _validation_group
            End Get
            Set(ByVal value As String)
                _validation_group = value
                EnsureChildControls()
                If validate Then
                    _linkbutton.ValidationGroup = _validation_group
                    _requiredfieldvalidator.ValidationGroup = _validation_group
                Else
                    _linkbutton.ValidationGroup = String.Empty
                    _requiredfieldvalidator.ValidationGroup = String.Empty
                End If
            End Set
        End Property

#End Region

    End Class


End Namespace